<?php

namespace App\Http\Requests;

use App\Http\Requests\Request;

class UserFromPostRequset extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
             'username' => 'required|max:255|min:1',
             'password' => 'required|max:60|min:6',
              'phone'=>'required|max:11|min:11',
             'email'=>'required',
             'pic'=>'image',
             'pic'=>'required',
        ];
    }
    public function messages()
    {
        return
        [
        'username.required' => '用户名不能为空',
        'username.max'=>'用户名最大不能超过255',
        'username.min'=>'用户名最小不能超过1',
        'password.required'=>'密码不能为空',
        'password.max'=>'密码最大不能超过60',
        'password.min'=>'密码最小不能超过6',
        'phone.min'=>'手机号最小不能超过11',
        'phone.required'=>'手机号不能为空',
        'email.required'=>'邮箱不能为空',
        'pic.image'=>'上传格式错误',
        'pic.required'=>'图片不能为空',

        ];
    }
}
